package com.iflytek.yly.jetpackdemo.databinding;

import androidx.databinding.BaseObservable;
import androidx.databinding.ObservableField;

public class TwoWayBindingViewModel2 extends BaseObservable {

    private ObservableField<LoginModel> loginModelObservableField;

    public TwoWayBindingViewModel2() {
        LoginModel loginModel = new LoginModel();
        loginModel.userName = "Chris";
        loginModelObservableField = new ObservableField<>();
        loginModelObservableField.set(loginModel);
    }

    public String getUserName() {
        return loginModelObservableField.get().userName;
    }

    public void setUserName(String userName) {

        loginModelObservableField.get().userName = userName;

    }
}
